Micron Document
<!DOCTYPE html>
<html class="client-nojs vector-feature-night-mode-disabled vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-sticky-header-enabled" lang="en" dir="ltr"><head>
<meta charset="UTF-8">
<title>Snippet (programming)</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="canonical" href="https://en.wikipedia.org/wiki/Snippet_(programming)"> <link href="./mw/ext.cite.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/ext.pygments.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.icons.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.search.codex.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/user.styles.css" rel="stylesheet" type="text/css">
<meta name="ResourceLoaderDynamicStyles" content="">
<link rel="stylesheet" type="text/css" href="./mw/site.styles.css">
<link rel="stylesheet" type="text/css" href="./mw/noscript.css">
<link rel="stylesheet" type="text/css" href="./footer.css">
<link rel="stylesheet" type="text/css" href="./vector-2022.css">
</head>
<body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject page-Snippet_programming rootpage-Snippet_programming skin-vector-2022 action-view">
<div class="mw-page-container">
<div class="mw-page-container-inner">
<div class="mw-content-container">
<main id="content" class="mw-body">
<header class="mw-body-header vector-page-titlebar">
<h1 id="firstHeading" class="firstHeading mw-first-heading">
<span id="openzim-page-title" class="mw-page-title-main"><span class="mw-page-title-main">Snippet (programming)</span></span>
</h1>
</header>
<a id="top"></a>
<div id="bodyContent" class="vector-body ve-init-mw-desktopArticleTarget-targetContainer" aria-labelledby="firstHeading" data-mw-ve-target-container="">
<div id="mw-content-text" class="mw-body-content mw-content-ltr" lang="en" dir="ltr"><div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr">

<style data-mw-deduplicate="TemplateStyles:r1305433154">
/* start https://en.wikipedia.org/ */


.mw-parser-output .ambox{border:1px solid #a2a9b1;border-left:10px solid #36c;background-color:#fbfbfb;box-sizing:border-box}.mw-parser-output .ambox+link+.ambox,.mw-parser-output .ambox+link+style+.ambox,.mw-parser-output .ambox+link+link+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+style+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+link+.ambox{margin-top:-1px}html body.mediawiki .mw-parser-output .ambox.mbox-small-left{margin:4px 1em 4px 0;overflow:hidden;width:238px;border-collapse:collapse;font-size:88%;line-height:1.25em}.mw-parser-output .ambox-speedy{border-left:10px solid #b32424;background-color:#fee7e6}.mw-parser-output .ambox-delete{border-left:10px solid #b32424}.mw-parser-output .ambox-content{border-left:10px solid #f28500}.mw-parser-output .ambox-style{border-left:10px solid #fc3}.mw-parser-output .ambox-move{border-left:10px solid #9932cc}.mw-parser-output .ambox-protection{border-left:10px solid #a2a9b1}.mw-parser-output .ambox .mbox-text{border:none;padding:0.25em 0.5em;width:100%}.mw-parser-output .ambox .mbox-image{border:none;padding:2px 0 2px 0.5em;text-align:center}.mw-parser-output .ambox .mbox-imageright{border:none;padding:2px 0.5em 2px 0;text-align:center}.mw-parser-output .ambox .mbox-empty-cell{border:none;padding:0;width:1px}.mw-parser-output .ambox .mbox-image-div{width:52px}@media(min-width:720px){.mw-parser-output .ambox{margin:0 10%}}@media print{body.ns-0 .mw-parser-output .ambox{display:none!important}}


/* end https://en.wikipedia.org/ */
</style>
<p><b>Snippet</b> is a programming term for a small region of re-usable <a href="Source_code" title="Source code">source code</a>, <a href="Machine_code" title="Machine code">machine code</a>, or text. Ordinarily, these are formally defined operative units to incorporate into larger <a href="Module_(programming)" class="mw-redirect" title="Module (programming)">programming modules</a>. <b>Snippet management</b> is a feature of some <a href="Text_editor" title="Text editor">text editors</a>, program <a href="Source_code_editor" class="mw-redirect" title="Source code editor">source code editors</a>, <a href="Integrated_development_environment" title="Integrated development environment">IDEs</a>, and related <a href="Software" title="Software">software</a>. It allows the user to avoid repetitive typing in the course of routine edit operations.<sup id="cite_ref-gedit_feature_1-0" class="reference"><a href="#cite_note-gedit_feature-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup>
</p>
<meta property="mw:PageProp/toc">
<div class="mw-heading mw-heading2"><h2 id="Definition">Definition</h2></div>
<p>In programming practice, "snippet" refers narrowly to a portion of source code that is literally included by an editor program into a file, and is a form of <a href="Copy_and_paste_programming" class="mw-redirect" title="Copy and paste programming">copy and paste programming</a>.<sup id="cite_ref-2" class="reference"><a href="#cite_note-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup> This concrete inclusion is in contrast to abstraction methods, such as <a href="Subroutine" class="mw-redirect" title="Subroutine">functions</a> or <a href="Macro_(computer_science)" title="Macro (computer science)">macros</a>, which are abstraction within the language. Snippets are thus primarily used when these abstractions are not available or not desired, such as in languages that lack abstraction, or for clarity and absence of overhead.
</p><p>Snippets are similar to having static preprocessing included in the editor, and do not require support by a compiler. On the flip side, this means that snippets cannot be invariably modified after the fact, and thus is vulnerable to all of the problems of copy and paste programming. For this reason snippets are primarily used for simple sections of code (with little logic), or for boilerplate, such as copyright notices, function prototypes, common control structures, or standard library imports.
</p>
<div class="mw-heading mw-heading2"><h2 id="Overview">Overview</h2></div>
<p>Snippet management is a text editor feature popular among software developers or others who routinely require content from a catalogue of repeatedly entered text (such as with <a href="Source_code" title="Source code">source code</a> or <a href="Boilerplate_(text)" class="mw-redirect" title="Boilerplate (text)">boilerplate</a>). Often this feature is justified because the content varies only slightly (or not at all) each time it is entered.
</p>
<div class="mw-heading mw-heading3"><h3 id="Snippets_in_text_editors">Snippets in text editors</h3></div>
<p>Text editors that include this feature ordinarily provide a mechanism to manage the catalogue, and separate "snippets" in the same manner that the text editor and operating system allow management of separate files. These <a href="Create%2C_read%2C_update_and_delete" title="Create, read, update and delete">basic management abilities</a> include operations such as viewing, adding, editing, deleting, sorting, filtering, grouping, renaming, and storing snippets in a <a href="Software_repository" title="Software repository">repository</a>, catalogue, or <a href="Database" title="Database">database</a>. Some editors provide a macro ability to snippets allowing function prototypes and variable control structures to be generated based on a standard template.
</p>
<div class="mw-heading mw-heading3"><h3 id="Snippets_in_IDEs">Snippets in IDEs</h3></div>
<p>Some programmer's applications such as <a href="Eclipse_(software)" title="Eclipse (software)">Eclipse</a>, <a href="NetBeans" title="NetBeans">NetBeans</a>, and Microsoft's <a href="Visual_Studio" title="Visual Studio">Visual Studio</a> (uses <a href="TextMate#Snippets" title="TextMate">TextMate</a>-inspired snippets underhood) and other <a href="Integrated_Development_Environment" class="mw-redirect" title="Integrated Development Environment">IDEs</a> include built-in parts of structure for ease of coding.
</p><p>Other applications such as Macromedia <a href="Dreamweaver" class="mw-redirect" title="Dreamweaver">Dreamweaver</a> make use of these code snippets as well for <a href="Web_development" title="Web development">Web development</a>.
</p>
<div class="mw-heading mw-heading3"><h3 id="Snippets_in_JIT_compilers">Snippets in JIT compilers</h3></div>
<p>Just-in-time (<a href="Just-in-time_compilation" title="Just-in-time compilation">JIT</a>) compilers can "splice together" pre-compiled sections of code as longer <a href="Object_code" title="Object code">object code</a>/<a href="Machine_code" title="Machine code">machine code</a> segments. This reduces interpret time significantly and simultaneously speeds execution.
</p>

<div class="mw-heading mw-heading3"><h3 id="Snippets_in_shells">Snippets in shells</h3></div>
<p>Snippets may be used inside commandline interfaces like bash, zsh (<a href="Linux" title="Linux">GNU Linux</a>/Unix-like) or powershell (<a href="Microsoft_Windows" title="Microsoft Windows">MS Windows</a>). Features like completion and placeholders substitution may or may not be supported.
</p>
<div class="mw-heading mw-heading2"><h2 id="Example">Example</h2></div>
<p>Consider the process of swapping the values of two variables, <i>x</i> and <i>y.</i> Assuming <a href="Strong_and_weak_typing" title="Strong and weak typing">weak typing</a> and not being concerned about name collision, this is represented by the code:
</p>
<pre>temp = x
x = y
y = temp
</pre>
<p>When the snippet is inserted, the programmer is prompted for the values of the two parameters. Assuming they are type <code>foo</code> and <code>bar</code>, which are the actual names of the variables they wish to swap, this will yield the code:
</p>
<pre>temp = foo
foo = bar
bar = temp
</pre>
<p>If the snippet is subsequently changed, say to use <code>__temp</code> instead of <code>temp</code>, it will not change the code that has already been inserted, but will be used in subsequent insertions of the snippet.
</p><p>A snippet for this might be represented as:
</p>
<pre>temp = $1
$1 = $2
$2 = temp
</pre>
<div class="mw-heading mw-heading2"><h2 id="Conventions">Conventions</h2></div>
<p>In addition to the basic management abilities described previously, snippet management features can be classified according to the scope of interactivity between snippets and the text editor or application that hosts them.
</p><p>These snippet feature groups include:
</p>
<ul><li>plain-text or "static" snippets</li>
<li>interactive or "dynamic" snippets</li>
<li>scriptable snippets</li></ul>
<dl><dt>Static</dt>
<dd>Snippets of this type consist primarily of fixed text that the user can choose to insert into the current document. The user is not able to specify anything else, except perhaps the cursor position relative to the newly inserted text. Static snippets are similar to simple <a href="Macro_(computer_science)" title="Macro (computer science)">macros</a>, excepting that macro are often evaluated (or inserted) by a <a href="Command-line_interface" title="Command-line interface">command-line program</a> instead of IDE.</dd></dl>
<dl><dt>Dynamic</dt>
<dd>Snippets consist of fixed text combined with dynamic elements (placeholders) which are allowed to be modified either by editor or by user. The user may specify both the content of the dynamic elements, as well as their position relative to the fixed text, as part of choosing what to insert into the current document. Examples of dynamic elements could be variables such as the current date or system time, or input from the user that is supplied via a GUI, or input from another application. (see also: <a href="Macro_(computer_science)#Programming_macros" title="Macro (computer science)">programmable macro</a>).</dd></dl>
<dl><dt>Scriptable</dt>
<dd>Snippets consist of runnable segments of code in either a macro language or a <a href="Scripting_language" title="Scripting language">scripting language</a>. Scriptable snippets provide the greatest degree of flexibility to the user, although that depends somewhat on the programming languages supported by the text editor, and whether or not the programming language is well-known, or particular and unique to that specific editor.</dd></dl>
<p>The type of scripting support varies, but may include features such as running <a href="Unix_shell" title="Unix shell">shell commands</a>, providing a <a href="Dialog_box" title="Dialog box">GUI dialog</a> or other methods of user interaction with the operating system; other applications; or other sub-components of the hosting application itself.
</p><p><br>
</p>
<div class="mw-heading mw-heading2"><h2 id="Snippet_placeholders">Snippet placeholders</h2></div>
<p>Placeholders are elements within a snippet that are left to be supplied by the user or other external process. The values for placeholders are not determined until the text of the snippet is inserted during an editing session.
</p><p>Placeholders may have special <a href="Markup_language" title="Markup language">markup syntax</a> that allows the editor to identify the boundaries of placeholders relative to the other text in the current edit buffer.
</p><p>Other applications employ <a href="Graphical_user_interface" title="Graphical user interface">graphical user interfaces</a> and <a href="Modal_window" title="Modal window">modal dialog boxes</a> that allow the user to enter one or more values to be supplied for the placeholders.
</p>
<div class="mw-heading mw-heading3"><h3 id="Placeholder_identifiers">Placeholder identifiers</h3></div>
<p>Placeholders are usually indicated by some special character or sequence of characters to distinguish them from the rest of the snippet text. Some systems allow snippet placeholders to be named <a href="Identifier" title="Identifier">identifiers</a>. The identifiers may be useful for supporting such features as placeholder duplication or placeholder transformation.
</p><p>The following example uses the identifiers <code>first_name</code>, <code>last_name</code>, and <code>item</code>:
</p>
<div class="mw-highlight mw-highlight-lang-jinja mw-content-ltr" dir="ltr"><pre><span class="x">Hello </span><span class="cp">{%</span><span class="k">first_name</span><span class="cp">%}</span><span class="x"> </span><span class="cp">{%</span><span class="k">last_name</span><span class="cp">%}</span><span class="x">,</span>

<span class="x">Your shipment of </span><span class="cp">{%</span><span class="k">item</span><span class="cp">%}</span><span class="x"> is now ready to pick up.</span>

<span class="x">Thanks </span><span class="cp">{%</span><span class="k">first_name</span><span class="cp">%}</span><span class="x">!</span>
</pre></div><p>Example of a snippet in <a href="TextMate" title="TextMate">TexMate</a> syntax: </p><div class="mw-highlight mw-highlight-lang-bash mw-content-ltr" dir="ltr"><pre>Hello<span class="w"> </span><span class="si">${</span><span class="nv">1</span><span class="p">:</span><span class="nv">first_name</span><span class="si">}</span><span class="w"> </span><span class="si">${</span><span class="nv">2</span><span class="p">:</span><span class="nv">last_name</span><span class="si">}</span>,

Your<span class="w"> </span>shipment<span class="w"> </span>of<span class="w"> </span><span class="si">${</span><span class="nv">3</span><span class="p">:</span><span class="nv">item</span><span class="si">}</span><span class="w"> </span>is<span class="w"> </span>now<span class="w"> </span>ready<span class="w"> </span>to<span class="w"> </span>pick<span class="w"> </span>up.

Thanks<span class="w"> </span><span class="si">${</span><span class="nv">4</span><span class="p">:</span><span class="nv">first_name</span><span class="si">}</span>!
</pre></div>
<div class="mw-heading mw-heading3"><h3 id="Placeholder_duplication">Placeholder duplication</h3></div>
<p>This allows the user to indicate that the value supplied for one placeholder should be replicated in multiple places, relative to the entire text of the programmable snippet. In the previous example, the named placeholder <code>first_name</code> is an example of this usage.
</p>
<div class="mw-heading mw-heading3"><h3 id="Placeholder_transformation">Placeholder transformation</h3></div>
<p>This allows the user to indicate that one or more values supplied for a placeholder should be replicated and transformed in other places within the text of the programmable snippet. For example, the user may supply a document title in one part of the snippet, and specify that the document title should be repeated in other places, with the first instance being all-uppercase and every other instance being lower-case.
</p>
<div class="mw-heading mw-heading2"><h2 id="Snippet_programming_features">Snippet programming features</h2></div>
<p>For applications that support <i>scriptable</i> snippets, the range of supported programming features varies. The following enumerates some of the features that are commonly implemented for programmable snippets.
</p>
<div class="mw-heading mw-heading3"><h3 id="Plain_text">Plain text</h3></div>
<p>Although plain text is a fundamental feature included even with applications that support only non-programmable "static" snippets, programmable snippets are also used for working with plain text.
</p><p>One common complication, however, is that environments that support programmable snippets often have to make distinctions between what counts as "plain text" and what counts as "programming instructions". Further complicating this distinction is the fact that applications that support programmable snippets almost always include support for recognition of multiple programming languages, either through basic <a href="Syntax_highlighting" title="Syntax highlighting">syntax highlighting</a> or execution of embedded commands.
</p><p>For these and other reasons, emitting plain text from programmable snippets almost always entails being careful to avoid problems with <a href="Syntax_of_programming_languages" class="mw-redirect" title="Syntax of programming languages">syntax</a> and <a href="Delimiter_collision" class="mw-redirect" title="Delimiter collision">delimiter collisions</a>.
</p>
<div class="mw-heading mw-heading3"><h3 id="Constants_and_variables">Constants and variables</h3></div>
<p>Programmable snippets often include an ability to establish a binding to an existing <a href="Scope_(computer_science)" title="Scope (computer science)">variable scope</a> or namespace, from which the user can select any of various constants or variables. These might include values such as the email address of the currently logged-in user on a given machine, the current system time and date, or the output value of a function.
</p><p>Scriptable snippets are often associated with one or more currently active files. Consequently, variables may also include <a href="Environment_variable" title="Environment variable">environment variables</a> and arguments that specify the filename, cursor position, and parent directory among other stats relating to the files in a current editing session.
</p>
<div class="mw-heading mw-heading3"><h3 id="Interpreted_code">Interpreted code</h3></div>
<p>Scriptable snippets may allow execution of code in one or more <a href="Programming_language" title="Programming language">programming languages</a>. This may include one or more standalone languages, or a language that is specific to the application in which the language is hosted.
</p>
<div class="mw-heading mw-heading2"><h2 id="Alternatives">Alternatives</h2></div>
<p>The most basic alternative to code snippets is <a href="Subroutine" class="mw-redirect" title="Subroutine">subroutines</a> in libraries. Subroutines can be incorporated into a reusable <a href="Software_library" class="mw-redirect" title="Software library">software library</a> and shared between multiple programming projects.
</p><p><a href="Design_patterns" class="mw-redirect" title="Design patterns">Design patterns</a> in object-oriented programming, and <a href="Functional_programming" title="Functional programming">functional programming</a>, are both techniques that can allow programmers to avoid or reduce the practice of repeatedly inserting snippets into different pieces of code with slight variations each time. In languages in the <a href="C_(programming_language)" title="C (programming language)">C</a> family, <a href="Preprocessor" title="Preprocessor">preprocessors</a> are sometimes used for this purpose.
</p><p>The disadvantage of this approach however is that it's harder to remember pattern or documentation.
</p>
<div class="mw-heading mw-heading3"><h3 id="Software_assistance">Software assistance</h3></div>
<p>As of 2021 some sophisticated <a href="Deep_learning" title="Deep learning">deep-learning</a> tooling emerged that can help to infer specific functionality from a human readable text and generate corresponding source code snippets (e.g. <a href="GitHub_Copilot" title="GitHub Copilot">GitHub Copilot</a>).<sup id="cite_ref-3" class="reference"><a href="#cite_note-3"><span class="cite-bracket">[</span>3<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-4" class="reference"><a href="#cite_note-4"><span class="cite-bracket">[</span>4<span class="cite-bracket">]</span></a></sup>
</p>
<div class="mw-heading mw-heading2"><h2 id="See_also">See also</h2></div>
<style data-mw-deduplicate="TemplateStyles:r1290876196">
/* start https://en.wikipedia.org/ */


.mw-parser-output .side-box{margin:4px 0;box-sizing:border-box;border:1px solid #aaa;font-size:88%;line-height:1.25em;background-color:var(--background-color-interactive-subtle,#f8f9fa);display:flow-root}.mw-parser-output .infobox .side-box{font-size:100%}.mw-parser-output .side-box-abovebelow,.mw-parser-output .side-box-text{padding:0.25em 0.9em}.mw-parser-output .side-box-image{padding:2px 0 2px 0.9em;text-align:center}.mw-parser-output .side-box-imageright{padding:2px 0.9em 2px 0;text-align:center}@media(min-width:500px){.mw-parser-output .side-box-flex{display:flex;align-items:center}.mw-parser-output .side-box-text{flex:1;min-width:0}}@media(min-width:720px){.mw-parser-output .side-box{width:238px}.mw-parser-output .side-box-right{clear:right;float:right;margin-left:1em}.mw-parser-output .side-box-left{margin-right:1em}}


/* end https://en.wikipedia.org/ */
</style><style data-mw-deduplicate="TemplateStyles:r1237033735">
/* start https://en.wikipedia.org/ */


@media print{body.ns-0 .mw-parser-output .sistersitebox{display:none!important}}@media screen{html.skin-theme-clientpref-night .mw-parser-output .sistersitebox img[src*="Wiktionary-logo-en-v2.svg"]{background-color:white}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .sistersitebox img[src*="Wiktionary-logo-en-v2.svg"]{background-color:white}}


/* end https://en.wikipedia.org/ */
</style><div class="side-box side-box-right sistersitebox"><style data-mw-deduplicate="TemplateStyles:r1126788409">
/* start https://en.wikipedia.org/ */


.mw-parser-output .plainlist ol,.mw-parser-output .plainlist ul{line-height:inherit;list-style:none;margin:0;padding:0}.mw-parser-output .plainlist ol li,.mw-parser-output .plainlist ul li{margin-bottom:0}


/* end https://en.wikipedia.org/ */
</style>
<div class="side-box-flex">
<div class="side-box-image"><span class="noviewer" typeof="mw:File"></span></div>
<div class="side-box-text plainlist">Look up <i><b><a href="https://en.wiktionary.org/wiki/snippet" class="extiw external" title="wiktionary:snippet">snippet</a></b></i> in Wiktionary, the free dictionary.</div></div>
</div>
<style data-mw-deduplicate="TemplateStyles:r1184024115">
/* start https://en.wikipedia.org/ */


.mw-parser-output .div-col{margin-top:0.3em;column-width:30em}.mw-parser-output .div-col-small{font-size:90%}.mw-parser-output .div-col-rules{column-rule:1px solid #aaa}.mw-parser-output .div-col dl,.mw-parser-output .div-col ol,.mw-parser-output .div-col ul{margin-top:0}.mw-parser-output .div-col li,.mw-parser-output .div-col dd{page-break-inside:avoid;break-inside:avoid-column}


/* end https://en.wikipedia.org/ */
</style><div class="div-col">
<ul><li><a href="Autocomplete" title="Autocomplete">Autocomplete</a>&nbsp;– Computing feature predicting ending to a word a user is typing</li>
<li><a href="Codebase" title="Codebase">Codebase</a>&nbsp;– Source-code collection used to build a system, application, or component</li>
<li><a href="Code_refactoring" title="Code refactoring">Code refactoring</a>&nbsp;– Restructuring existing computer code without changing its external behavior</li>
<li><a href="Content_management" title="Content management">Content management</a>&nbsp;– Creation and presentation of information for an audience</li>
<li><a href="Pastebin" title="Pastebin">Pastebin</a>&nbsp;– Type of online content hosting service where users can store plain text</li>
<li><a href="Scrapbook_(Mac_OS)" title="Scrapbook (Mac OS)">Scrapbook (Mac OS)</a>&nbsp;– Macintosh computer software</li>
<li><a href="Version_control" title="Version control">Version control</a>&nbsp;– Managing versions of source code or data</li>
<li><a href="Web_widget" title="Web widget">Web widget</a>&nbsp;– Applet intended to be used within web pages</li></ul>
</div>
<div class="mw-heading mw-heading2"><h2 id="References">References</h2></div>
<style data-mw-deduplicate="TemplateStyles:r1239543626">
/* start https://en.wikipedia.org/ */


.mw-parser-output .reflist{margin-bottom:0.5em;list-style-type:decimal}@media screen{.mw-parser-output .reflist{font-size:90%}}.mw-parser-output .reflist .references{font-size:100%;margin-bottom:0;list-style-type:inherit}.mw-parser-output .reflist-columns-2{column-width:30em}.mw-parser-output .reflist-columns-3{column-width:25em}.mw-parser-output .reflist-columns{margin-top:0.3em}.mw-parser-output .reflist-columns ol{margin-top:0}.mw-parser-output .reflist-columns li{page-break-inside:avoid;break-inside:avoid-column}.mw-parser-output .reflist-upper-alpha{list-style-type:upper-alpha}.mw-parser-output .reflist-upper-roman{list-style-type:upper-roman}.mw-parser-output .reflist-lower-alpha{list-style-type:lower-alpha}.mw-parser-output .reflist-lower-greek{list-style-type:lower-greek}.mw-parser-output .reflist-lower-roman{list-style-type:lower-roman}


/* end https://en.wikipedia.org/ */
</style><div class="reflist">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-gedit_feature-1"><span class="mw-cite-backlink"><b><a href="#cite_ref-gedit_feature_1-0">^</a></b></span> <span class="reference-text"><style data-mw-deduplicate="TemplateStyles:r1238218222">
/* start https://en.wikipedia.org/ */


.mw-parser-output cite.citation{font-style:inherit;word-wrap:break-word}.mw-parser-output .citation q{quotes:"\"""\"""'""'"}.mw-parser-output .citation:target{background-color:rgba(0,127,255,0.133)}.mw-parser-output .id-lock-free.id-lock-free a{background:url("./mw/Lock-green.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-limited.id-lock-limited a,.mw-parser-output .id-lock-registration.id-lock-registration a{background:url("./mw/Lock-gray-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-subscription.id-lock-subscription a{background:url("./mw/Lock-red-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .cs1-ws-icon a{background:url("./mw/Wikisource-logo.svg")right 0.1em center/12px no-repeat}body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-free a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-limited a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-registration a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-subscription a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .cs1-ws-icon a{background-size:contain;padding:0 1em 0 0}.mw-parser-output .cs1-code{color:inherit;background:inherit;border:none;padding:inherit}.mw-parser-output .cs1-hidden-error{display:none;color:var(--color-error,#d33)}.mw-parser-output .cs1-visible-error{color:var(--color-error,#d33)}.mw-parser-output .cs1-maint{display:none;color:#085;margin-left:0.3em}.mw-parser-output .cs1-kern-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right{padding-right:0.2em}.mw-parser-output .citation .mw-selflink{font-weight:inherit}@media screen{.mw-parser-output .cs1-format{font-size:95%}html.skin-theme-clientpref-night .mw-parser-output .cs1-maint{color:#18911f}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .cs1-maint{color:#18911f}}


/* end https://en.wikipedia.org/ */
</style><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://web.archive.org/web/20120825201711/https://live.gnome.org/Gedit/Plugins/Snippets">"Gedit/Plugins/Snippets"</a>. Archived from <a rel="nofollow" class="external text" href="http://live.gnome.org/Gedit/Plugins/Snippets">the original</a> on 2012-08-25<span class="reference-accessdate">. Retrieved <span class="nowrap">2010-01-09</span></span>.</cite> Example of the feature in the Gedit editor.</span>
</li>
<li id="cite_note-2"><span class="mw-cite-backlink"><b><a href="#cite_ref-2">^</a></b></span> <span class="reference-text"><cite id="CITEREFKimBergmanLauNotkin2004" class="citation book cs1">Kim, Miryung; Bergman, Lawrence; Lau, Tessa; Notkin, David (2004). <a rel="nofollow" class="external text" href="https://web.archive.org/web/20161019072101/http://pike.cs.ucla.edu/~miryung/Publications/isese04-copypaste.pdf">"An ethnographic study of copy and paste programming practices in OOPL"</a> <span class="cs1-format">(PDF)</span>. <i>Proceedings: 2004 International Symposium on Empirical Software Engineering, ISESE 2004: 19–20 August 2004, Redondo Beach, California</i>. Los Alamitos, CA: <a href="IEEE" class="mw-redirect" title="IEEE">IEEE</a>. pp.&nbsp;<span class="nowrap">83–</span>92. <a href="ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a>&nbsp;<bdi>978-0-7695-2165-7</bdi>. <a href="OCLC_(identifier)" class="mw-redirect" title="OCLC (identifier)">OCLC</a>&nbsp;<a rel="nofollow" class="external text" href="https://search.worldcat.org/oclc/326620442">326620442</a>. Archived from <a rel="nofollow" class="external text" href="http://pike.cs.ucla.edu/~miryung/Publications/isese04-copypaste.pdf">the original</a> <span class="cs1-format">(PDF)</span> on 19 October 2016<span class="reference-accessdate">. Retrieved <span class="nowrap">18 October</span> 2016</span>. <q>For each C&amp;P instance, we also noted the relationship between a copied code snippet and code elsewhere in the code base.</q></cite></span>
</li>
<li id="cite_note-3"><span class="mw-cite-backlink"><b><a href="#cite_ref-3">^</a></b></span> <span class="reference-text"><cite id="CITEREFH._M._LECHENALI_BABAR2021" class="citation journal cs1">H. M. LE, TRIET; CHEN, HAO; ALI BABAR, MUHAMMAD (2021). "Deep Learning for Source Code Modeling and Generation". <i>ACM Computing Surveys</i>. <b>53</b> (3). The University of Adelaide: <span class="nowrap">1–</span>38. <a href="ArXiv_(identifier)" class="mw-redirect" title="ArXiv (identifier)">arXiv</a>:<span class="id-lock-free" title="Freely accessible"><a rel="nofollow" class="external text" href="https://arxiv.org/abs/2002.05442">2002.05442</a></span>. <a href="Doi_(identifier)" class="mw-redirect" title="Doi (identifier)">doi</a>:<a rel="nofollow" class="external text" href="https://doi.org/10.1145%2F3383458">10.1145/3383458</a>. <a href="S2CID_(identifier)" class="mw-redirect" title="S2CID (identifier)">S2CID</a>&nbsp;<a rel="nofollow" class="external text" href="https://api.semanticscholar.org/CorpusID:211096967">211096967</a>.</cite></span>
</li>
<li id="cite_note-4"><span class="mw-cite-backlink"><b><a href="#cite_ref-4">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://techcrunch.com/2021/06/29/github-previews-new-ai-tool-that-makes-coding-suggestions/">"GitHub previews new AI tool that makes coding suggestions"</a>. <i>TechCrunch</i>. 29 June 2021<span class="reference-accessdate">. Retrieved <span class="nowrap">2021-07-25</span></span>.</cite></span>
</li>
</ol></div></div></div><!--htdig_noindex--><div><div class="zim-footer">
This article is issued from <a class="external text" title="Last edited on 2024-11-05" href="https://en.wikipedia.org/wiki/?title=Snippet_(programming)&amp;oldid=1255451958">Wikipedia</a>. The text is available under <a class="external text" href="https://creativecommons.org/licenses/by-sa/4.0/deed.en">Creative Commons Attribution-Share Alike 4.0</a> unless otherwise noted. Additional terms may apply for the media files.
</div>
</div><!--/htdig_noindex--></div>
</div>
</main>
</div>
</div>
</div>

</body></html>